package com.jianger.service;

import com.jianger.conf.DaoFactory;
import com.jianger.dao.TaskDao;
import com.jianger.pojo.Task;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.sql.SQLContext;

import java.util.List;

/**
 * @author jianger
 * @ date  2018/4/4-16:15
 * @project com.jianger.service
 */
public class UserTest {


    public static void main(String[] args) {

        SparkConf sparkConf = new SparkConf().setAppName("UserTest").setMaster("local");

        JavaSparkContext javaSparkContext = new JavaSparkContext(sparkConf);

        SQLContext sqlContext = new SQLContext(javaSparkContext);
        JavaRDD<String> stringJavaRDD = javaSparkContext.textFile("C:\\Users\\jianger\\Desktop\\ssh.txt");
        List<String> take = stringJavaRDD.take(4);
        TaskDao taskDao = DaoFactory.getTaskDaoImpl();
        Task taskById = taskDao.findTaskById(1);
        System.out.println(taskById.toString());


    }


}
